from django.contrib import admin

from pytest.models import *


class ConfigAreaAdmin(admin.ModelAdmin):
    # fields = ('id', 'name', 'description','configarealevel_set')  # 在编辑时显示
    list_display = ('id', 'name', 'description') #在列表显示
    search_fields = ('id', 'name')  # 添加快速查询栏


admin.site.register(ConfigArea, ConfigAreaAdmin)

class ConfigAreaLevelAdmin(admin.ModelAdmin):
    list_display = ('id','name','config_area')

admin.site.register(ConfigAreaLevel, ConfigAreaLevelAdmin)

#控制显示哪些字段
class ConfigItemAdmin(admin.ModelAdmin):
    list_display = ('id', 'type', 'name', 'description')  # 添加字段显示
    search_fields = ('id', 'name')  # 添加快速查询栏


admin.site.register(ConfigItem, ConfigItemAdmin)

class UserAdmin(admin.ModelAdmin):
    list_display = ('id','name','email','icon','create_date')

admin.site.register(User,UserAdmin)

class UserDescAdmin(admin.ModelAdmin):
    list_display = ('id','user','description')

admin.site.register(UserDesc,UserDescAdmin)